package builder;

import java.util.Vector;

import model.Action;

public class FlyweightBuilder extends AbstractPatternBuilder {

	private String flyweightFactory = "FlyweightFactory";
	private String flyweight = "Flyweight";
	private String client = "Client";
	private String concreteFlyweight = "ConcreteFlyweight";
	private String unsharedConcreteFlyweight = "UnsharedConcreteFlyweight";
	
	public FlyweightBuilder() {
		super();
	}

	@Override
	public Vector<Action> buildPattern() {
		
		this.buildClass(client);
		this.buildClass(flyweightFactory);
		this.buildClass(concreteFlyweight);
		this.buildClass(unsharedConcreteFlyweight);
		
		this.buildAbstractClass(flyweight);
		
		this.buildGeneralization(concreteFlyweight, flyweight);
		this.buildGeneralization(unsharedConcreteFlyweight, flyweight);
		
		this.buildAssociation(client,flyweightFactory);
		this.buildAssociation(client,concreteFlyweight);
		this.buildAssociation(client,unsharedConcreteFlyweight);
		
		this.buildAggregation(flyweight,flyweightFactory);	
		
		return patternActions;
	}

	@Override
	public void changeNames() {

		flyweightFactory = names.get(0);
		flyweight = names.get(1);
		client = names.get(2);
		concreteFlyweight = names.get(3);
		unsharedConcreteFlyweight = names.get(4);

	}
	
	@Override
	public int cantUMLElements() {
		return 5;
	}

}
